home *** CD-ROM | disk | FTP | other *** search
- Path: jupiter.sun.csd.unb.ca!e5ir
- From: e5ir@jupiter.sun.csd.unb.ca (Paul Vermette [NiD/BiM])
- Newsgroups: comp.lang.c++
- Subject: Re: Arrays in C and c++
- Date: 14 Apr 1996 20:37:45 GMT
- Organization: University of New Brunswick, Fredericton, NB, Canada
- Message-ID: <4krnmp$pf8@sol.sun.csd.unb.ca>
- References: <4kc929$38k@hermes.acs.unt.edu>
- NNTP-Posting-Host: jupiter-alt3.unb.ca
- X-Newsreader: TIN [version 1.2 PL2]
-
- Joseph Neal Rake (jnr0001@jove.acs.unt.edu) wrote:
- : Is it possible to do 2 dimensional arrays in C or C++? If so, how?
-
- : This is probably a related question: How does one do an array of strings
- : in C or C++, since 1 string is already an array?
-
- : Thanx for any help
-
- well, I always use a pointer the screen when doing graphics routine which
- the screen is in two dimensions and I am using a 1 dimensional array..
-
- The idea behind it is that
- screen[320][200] = screen[x][y] = screen[320*y + x]
-
- Just apply this to two dimensional or n-dimensional array, and this way
- you can dynamically allocate it with the new operator which would just be
- like
-
- char * strname = new char[320*200];
-
- well you get the idea
-
- : --
- : This message was authored by Joseph Neal Rake, esquire
- : Look for TennisMan on IRC
- : Check out my home page, the pictures are working again!
- : http://www.umr.edu/~jnrake
-
- --
- '''
- (o o)
- .---------oOOO---(_)------------------.
- | Paul Vermette [NiD/BiM] |
- | e5ir@unb.ca |
- | B O D i E S i N M o T i O N |
- `----------------------oOOO-----------'
- |__|__|
- || ||
- ooO Ooo
-
-